<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>QtWebApp: httpserver/httpsessionstore.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">QtWebApp
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('httpsessionstore_8h_source.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">httpsessionstore.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="httpsessionstore_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160; </div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#ifndef HTTPSESSIONSTORE_H</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#define HTTPSESSIONSTORE_H</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160; </div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;QObject&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;QMap&gt;</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="preprocessor">#include &lt;QTimer&gt;</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor">#include &lt;QMutex&gt;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="httpglobal_8h.html">httpglobal.h</a>&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="httpsession_8h.html">httpsession.h</a>&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="httpresponse_8h.html">httpresponse.h</a>&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="httprequest_8h.html">httprequest.h</a>&quot;</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160; </div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="keyword">namespace </span>stefanfrings {</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160; </div>
<div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1HttpSessionStore.html">   35</a></span>&#160;<span class="keyword">class </span>DECLSPEC <a class="code" href="classstefanfrings_1_1HttpSessionStore.html">HttpSessionStore</a> : <span class="keyword">public</span> QObject {</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    Q_OBJECT</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    Q_DISABLE_COPY(<a class="code" href="classstefanfrings_1_1HttpSessionStore.html">HttpSessionStore</a>)</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160; </div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <a class="code" href="classstefanfrings_1_1HttpSessionStore.html">HttpSessionStore</a>(<span class="keyword">const</span> QSettings* settings, QObject* parent=<span class="keyword">nullptr</span>);</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <span class="keyword">virtual</span> ~<a class="code" href="classstefanfrings_1_1HttpSessionStore.html">HttpSessionStore</a>();</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160; </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    QByteArray getSessionId(<a class="code" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a>&amp; request, <a class="code" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a>&amp; response);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160; </div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    <a class="code" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> getSession(<a class="code" href="classstefanfrings_1_1HttpRequest.html">HttpRequest</a>&amp; request, <a class="code" href="classstefanfrings_1_1HttpResponse.html">HttpResponse</a>&amp; response, <span class="keyword">const</span> <span class="keywordtype">bool</span> allowCreate=<span class="keyword">true</span>);</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160; </div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <a class="code" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> getSession(<span class="keyword">const</span> QByteArray <span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160; </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="keywordtype">void</span> removeSession(<span class="keyword">const</span> <a class="code" href="classstefanfrings_1_1HttpSession.html">HttpSession</a> session);</div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160; </div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="keyword">protected</span>:</div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1HttpSessionStore.html#a25bcdad5accd436881927a414b99ba22">   92</a></span>&#160;    QMap&lt;QByteArray,HttpSession&gt; <a class="code" href="classstefanfrings_1_1HttpSessionStore.html#a25bcdad5accd436881927a414b99ba22">sessions</a>;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160; </div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="keyword">private</span>:</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160; </div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="keyword">const</span> QSettings* settings;</div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160; </div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    QTimer cleanupTimer;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160; </div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    QByteArray cookieName;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <span class="keywordtype">int</span> expirationTime;</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160; </div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    QMutex mutex;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160; </div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;<span class="keyword">private</span> slots:</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    <span class="keywordtype">void</span> sessionTimerEvent();</div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160; </div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;signals:</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00122"></a><span class="lineno"><a class="line" href="classstefanfrings_1_1HttpSessionStore.html#ace45645f705afa06389fb62b78dcc069">  122</a></span>&#160;    <span class="keywordtype">void</span> <a class="code" href="classstefanfrings_1_1HttpSessionStore.html#ace45645f705afa06389fb62b78dcc069">sessionDeleted</a>(<span class="keyword">const</span> QByteArray&amp; sessionId);</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;};</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160; </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;} <span class="comment">// end of namespace</span></div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160; </div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="preprocessor">#endif </span><span class="comment">// HTTPSESSIONSTORE_H</span></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpRequest_html"><div class="ttname"><a href="classstefanfrings_1_1HttpRequest.html">stefanfrings::HttpRequest</a></div><div class="ttdoc">This object represents a single HTTP request.</div><div class="ttdef"><b>Definition:</b> <a href="httprequest_8h_source.html#l00038">httprequest.h:38</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpResponse_html"><div class="ttname"><a href="classstefanfrings_1_1HttpResponse.html">stefanfrings::HttpResponse</a></div><div class="ttdoc">This object represents a HTTP response, used to return something to the web client.</div><div class="ttdef"><b>Definition:</b> <a href="httpresponse_8h_source.html#l00036">httpresponse.h:36</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpSessionStore_html"><div class="ttname"><a href="classstefanfrings_1_1HttpSessionStore.html">stefanfrings::HttpSessionStore</a></div><div class="ttdoc">Stores HTTP sessions and deletes them when they have expired.</div><div class="ttdef"><b>Definition:</b> <a href="httpsessionstore_8h_source.html#l00035">httpsessionstore.h:35</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpSessionStore_html_a25bcdad5accd436881927a414b99ba22"><div class="ttname"><a href="classstefanfrings_1_1HttpSessionStore.html#a25bcdad5accd436881927a414b99ba22">stefanfrings::HttpSessionStore::sessions</a></div><div class="ttdeci">QMap&lt; QByteArray, HttpSession &gt; sessions</div><div class="ttdoc">Storage for the sessions.</div><div class="ttdef"><b>Definition:</b> <a href="httpsessionstore_8h_source.html#l00092">httpsessionstore.h:92</a></div></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpSessionStore_html_ace45645f705afa06389fb62b78dcc069"><div class="ttname"><a href="classstefanfrings_1_1HttpSessionStore.html#ace45645f705afa06389fb62b78dcc069">stefanfrings::HttpSessionStore::sessionDeleted</a></div><div class="ttdeci">void sessionDeleted(const QByteArray &amp;sessionId)</div><div class="ttdoc">Emitted when the session is deleted.</div></div>
<div class="ttc" id="aclassstefanfrings_1_1HttpSession_html"><div class="ttname"><a href="classstefanfrings_1_1HttpSession.html">stefanfrings::HttpSession</a></div><div class="ttdoc">This class stores data for a single HTTP session.</div><div class="ttdef"><b>Definition:</b> <a href="httpsession_8h_source.html#l00023">httpsession.h:23</a></div></div>
<div class="ttc" id="ahttpglobal_8h_html"><div class="ttname"><a href="httpglobal_8h.html">httpglobal.h</a></div></div>
<div class="ttc" id="ahttprequest_8h_html"><div class="ttname"><a href="httprequest_8h.html">httprequest.h</a></div></div>
<div class="ttc" id="ahttpresponse_8h_html"><div class="ttname"><a href="httpresponse_8h.html">httpresponse.h</a></div></div>
<div class="ttc" id="ahttpsession_8h_html"><div class="ttname"><a href="httpsession_8h.html">httpsession.h</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_32a529a3b2babe504aaf73e401f143d0.html">httpserver</a></li><li class="navelem"><a class="el" href="httpsessionstore_8h.html">httpsessionstore.h</a></li>
    <li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
  </ul>
</div>
</body>
</html>
